Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: Update knowledge check href #28694

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

mathdebate09
Copy link
Contributor

@mathdebate09 mathdebate09 commented Aug 24, 2024

Because

The What does the #each_with_index method do? on Knowledge Check links to the beginning of the page

This PR

  • Update with the recommended href

Issue

Closes #28689

Additional Information

The linter will probably scream at this, but I still went ahead with the changes recommnded, let me know for any changes :D

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: Ruby Involves the Ruby course label Aug 24, 2024
@JoshDevHub
Copy link
Contributor

Thanks for making this PR. I didn't realize the linter would complain about this solution. Gonna tag a couple of people to get some thoughts on it.

@MaoShizhong @thatblindgeye So with this the situation is that we have a heading that's ### The each_with_index method. Our Kramdown code strips the underscores from the href name when creating the section links. So to have a working link with the heading as is, the link's href must also be stripped of the underscores. But doing this has mdlint complaining because it now thinks the link's href isn't a valid reference to any heading on the page.

Do either of you have any thoughts about the best way forward on this?

@JoshDevHub JoshDevHub self-requested a review August 24, 2024 15:45
@JoshDevHub JoshDevHub self-assigned this Aug 24, 2024
@MaoShizhong
Copy link
Contributor

MaoShizhong commented Aug 24, 2024

@JoshDevHub Let's accept this solution for now since we need it for the link to actually work.

Related is #28330 - markdownlint uses GitHub's section heading algorithm which removes /[^\p{Word}\- ]/u, i.e. underscores are not removed as they count as connector punctuation. I didn't realise there were even more differences between that algo and Rails' #parameterize method. This definitely throws a spanner in the works and my custom rule is no longer a sufficient fix IMHO.

Initial ideas which I'll discuss further with Eric and Kevin:

  1. Disable MD051
  2. Disable MD051 then write a custom version that uses Rails' #parameterize algo
  3. Change our website to use the GitHub algo instead of #parameterize, though this will break a potential many links which we'd need to lint the whole curriculum for to fix any MD051 violations.

Copy link
Contributor

@JoshDevHub JoshDevHub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the awesome input @MaoShizhong

I'll go ahead and approve this just so the link is fixed.

@JoshDevHub JoshDevHub merged commit a8a4901 into TheOdinProject:main Aug 24, 2024
2 of 3 checks passed
@MaoShizhong MaoShizhong mentioned this pull request Aug 25, 2024
7 tasks
@mathdebate09 mathdebate09 deleted the update_href branch August 27, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Ruby Involves the Ruby course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby: Basic Enumerable Methods: <Href not linking back>
3 participants